# This is a sample Python script.

import json
import secrets
import requests

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import spacy


def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.


def post(url, data=None):
    data = json.dumps(data, ensure_ascii=False)
    data = data.encode(encoding="utf-8")
    r = requests.post(url=url, data=data)
    r = json.loads(r.text)
    return r

# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    # sender = secrets.token_urlsafe(16)
    url = "http://localhost:5005/webhooks/rest/webhook"
    while True:
        message = input("Your input ->  ")
        data = {
            "sender": sender,
            "message": message
        }
        result = post(url, data)
        for i in result:
            print(i)


# See PyCharm help at https://www.jetbrains.com/help/pycharm/
